<template>
  <div class="home-container">
    <NavigationHeader />
    <el-main class="main-content">
      <div class="user-info-card">
        <h2>登录用户信息</h2>
        <el-divider />
        <pre>{{ userStore.user }}</pre>
      </div>
    </el-main>
  </div>
</template>

<script setup>
import { onMounted } from 'vue'
import { useUserStore } from '../store/user'
import NavigationHeader from '../components/NavigationHeader.vue'

const userStore = useUserStore()

onMounted(() => {
  if (!userStore.isLoggedIn) {
    router.replace('/login')
  }
})
</script>

<style scoped>
.home-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 40px;
  background: var(--el-bg-color-page);
}

.user-info-card {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--el-box-shadow-light);
}

pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}
</style>